fix: correct Copilot extension command registration#1724
fix: correct Copilot extension command registration#1724ismaelJimenez wants to merge 2 commits intogithub:mainfrom
Conversation
- Use .agent.md extension for commands in .github/agents/ - Generate companion .prompt.md files in .github/prompts/ - Clean up .prompt.md files on extension removal - Add tests for Copilot-specific registration behavior Bumps version to 0.1.7.
There was a problem hiding this comment.
Pull request overview
This PR fixes three bugs in the specify extension add --dev flow for GitHub Copilot projects: the wrong file extension was used for agent commands (.md instead of .agent.md), companion .prompt.md files in .github/prompts/ were never generated, and those companion files were not deleted on extension removal. The fixes bring the CLI's CommandRegistrar in line with the existing create-release-packages.sh script, which already handled all three cases correctly.
Changes:
CommandRegistrar.AGENT_CONFIGS["copilot"]["extension"]corrected to.agent.md; new_write_copilot_prompt()static helper generates companion.prompt.mdfiles during registration;remove()now also deletes companion.prompt.mdfiles for Copilot- Five new unit tests covering the Copilot-specific registration and cleanup behavior
- Version bumped to
0.1.7and CHANGELOG updated
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/specify_cli/extensions.py |
Core fix: corrects .agent.md extension, adds _write_copilot_prompt(), adds prompt-file cleanup in remove() |
tests/test_extensions.py |
Five new tests for Copilot registration and cleanup behavior |
pyproject.toml |
Version bump 0.1.6 → 0.1.7 |
CHANGELOG.md |
Adds [0.1.7] entry describing the three fixes |
The production code changes in extensions.py are correct and well-structured. However, there is one critical issue with the test suite:
The new test_copilot_cleanup_removes_prompt_files test does not actually call ExtensionManager.remove(). It manually unlinks the files with Path.unlink(), so the new cleanup logic introduced in remove() (lines 458–462 of extensions.py) is never exercised by any test. If that code contained a bug (e.g., wrong path, wrong condition), this test would still pass.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…d of manual unlink
mnriem
left a comment
There was a problem hiding this comment.
Can you pull in the latest changes from main?
Bumps version to 0.1.7.
Description
The
specify extension add --devcommand didn't work correctly for GitHub Copilot projects. Three issues were identified and fixed:.mdinstead of.agent.mdin.github/agents/, so Copilot couldn't discover them as agent files..prompt.mdfile in.github/prompts/for each agent — these were never generated.specify extension remove, the.prompt.mdcompanion files were not deleted.The root cause was a mismatch between
CommandRegistrar.AGENT_CONFIGS(used by the CLI) and the release packaging script (create-release-packages.sh), which correctly handled all three cases.Testing
uv sync && uv run pytestuv run specify --help107 tests pass. New tests added:
test_register_commands_for_copilot— verifies.agent.mdextension is usedtest_copilot_companion_prompt_created— verifies.prompt.mdgenerationtest_copilot_aliases_get_companion_prompts— verifies aliases also get promptstest_non_copilot_agent_no_companion_file— verifies no prompts for other agentstest_copilot_cleanup_removes_prompt_files— verifies cleanup of prompt filesAI Disclosure
GitHub Copilot (Claude Opus 4.6) was used to investigate the bug, implement the fix, and write the tests. All changes were reviewed and validated by a human.